<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>评论列表</title>
    <link rel="stylesheet" href="/addons/comments/assets/layui/css/layui.css">
    <link rel="stylesheet" href="/addons/comments/assets/css/admin.css">
</head>
<body>
    <div class="layui-card">
        <div class="layui-card-body">
            <form action=""  class="layui-form">
                <div class="layui-form-item">
                    <div class="layui-input-inline">
                        <input type="text" name="keywords" value="{$search.keywords|default=''}" class="layui-input" placeholder="评论内容">
                    </div>
                    <div class="layui-input-inline">
                        <select name="topic_type" >
                            <option value="1" {if request()->param('topic_type') eq 1}selected{/if}>文章</option>
                            <option value="2" {if request()->param('topic_type') eq 2}selected{/if}>视频</option>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <button class="layui-btn" lay-submit lay-filter="formDemo">搜索</button>
                        <a href="javascript:history.go(-1);" class="layui-btn">返回上一页</a>
                    </div>

                </div>
            </form>
            <form action="{:addons_url('comments://admin_index/delete')}" method="post" class="layui-form " >
                <div class="layui-btn-group">
                    <button type="submit" class="layui-btn layui-btn-xs layui-btn-danger ">
                        <i class="layui-icon">&#xe640;</i>
                        删除
                    </button>
                </div>
                <table class="layui-table">
                    <tr>
                        <td width="10">
                            <input type="checkbox" class="layui-input"  lay-skin="primary" lay-filter="select-all">
                        </td>
                        <td width="300">主题</td>
                        <td width="120">类型</td>
                        <td width="300">评论类容</td>
                        <td width="120">评论用户</td>
                        <td width="150">评论时间</td>
                        <td width="120">状态</td>
                        <td width="">操作</td>
                    </tr>
                    {volist name="dataList" id="v"}
                    <tr>
                        <td align="center" valign="middle">
                            <input type="checkbox" name="idList[]" class="layui-input" lay-skin="primary" value="{$v.id|default=0}">
                        </td>
                        <td>
                            {switch name='v.topic_type'}

                            {case value='1'} {$v.article.post_title|default=''} {/case}

                            {/switch}
                        </td>
                        <td>
                            {switch name='v.topic_type'}

                            {case value='1'}文章{/case}

                            {/switch}
                        </td>
                        <td>{$v.content}</td>
                        <td>{$v.user.nickname|default=$v.user.username}</td>
                        <td>{$v.update_time}</td>
                        <td>
                            {switch name='v.is_status'}

                            {case value='0'} <span style="color:red">未审核</span> {/case}
                            {case value='1'} <span style="color:green">已审核</span> {/case}

                            {/switch}
                        </td>
                        <td>
                            <a class="layui-btn layui-btn-xs" href="{:addons_url('comments://admin_index/read',['id'=>$v.id,'topic_type'=>$topic_type])}">查看</a>
                            <button class="layui-btn layui-btn-xs reply" data-url="{:addons_url('comments://admin_index/create')}" data-uid="{:_get_current_admin_id()}" data-list="{$v}" type="button" href="{:addons_url('comments://admin_index/read',['id'=>$v.id])}">回复</button>
                        </td>
                    </tr>
                    {/volist}
                </table>
            </form>
            {$dataList|raw}
        </div>
    </div>
</body>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="/addons/comments/assets/layui/layui.js"></script>
<script src="/addons/comments/assets/js/admin.js"></script>
</html>